import Vue from 'vue';
import App from './App';
import router from './router';
import https from './utils/request';
import './utils/rem.js';
import './assets/css/main.css';
import './assets/iconfont/iconfont.css';
import "video.js/dist/video-js.css";
import {getConfig} from "@/api/index";
import '@vant/touch-emulator';
import wx from 'weixin-js-sdk';
import VConsole from 'vconsole';
import Empty from "./components/notFind/notFind.vue"; // 无内容组件
import Zrsfooter from "./components/zrsfooter/Zrsfooter.vue"; // 无内容组件
import wechat from "./components/wxWechat/Wxwechat.vue";
import Navigation from 'vue-navigation'; //缓存组件
import store from './store/store';
import {Notify,Dialog,Toast} from 'vant';
import {addDebounceDirective,addThrottleDirective} from './utils/debounce';
// Toast 全局设置
Toast.allowMultiple();
Toast.setDefaultOptions('loading', { forbidClick: true,duration:6000});
/**
 * loadsh
 * addDebounceDirective 按钮防抖处理
 * addThrottleDirective 按钮节流处理
 * 指令方式
 * v-debounce-click 防抖 <el-button v-debounce-click="method"/>
 * v-debounce-click 节流 <el-button v-throttle-click="method"/>
 */

addDebounceDirective(Vue);
addThrottleDirective(Vue);
Vue.use(Notify,Dialog)
Vue.component('empty', Empty);
Vue.component('footers', Zrsfooter);
Vue.component('wechat', wechat);
Vue.use(Navigation, {router})
getConfig().then(
  (apis) => {
    if(apis.IS_CONSOLE_LOG){
      new VConsole();
    }
    new Vue({
      el: '#app',
      store,
      router,
      render: h => h(App),
      beforeMount() {
        Vue.prototype.$http = https;
        Vue.prototype.$API = apis;
        Vue.prototype.$WX = wx;
      }
    });
  }
);




